extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "小菲尔"                   # 角色的名称
	attCoe.atkRan = 1                 # 攻击距离
	attCoe.maxHp = 5                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 7.5                   # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 2.5                 # 魔法攻击（每点代表13.7）
	attCoe.def = 4.2                    # 物理防御（每点代表15）
	attCoe.mgiDef = 4.1                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dao" 
	xb = "火"
	lv = 3
	addSkillTxt("[无极炎]右拳使用无极之炎快速划破空气攻击敌方单体，造成125%火系物理伤害，20%概率触发炽火令[CD:8]")
	addSkillTxt("[炽火令]燃烧世间一切的精灵王号令，提升自身物攻20%并<灼烧>敌方单体4秒，最高提升至60%[CD:10]")
	addSkillTxt("[镇魔焰]以魔镇魔，向体力最低的敌方亚比挥出魔焰弹，造成150%的暗系物理伤害，可暴击，提升自身暴击率10%，最高至60%\n若暴击则提升爆伤50%（最高50%）并<灼烧>4秒[CD:13]")
	addCdSkill("wujiyan",8)
	addCdSkill("chihuoling",10)
	addCdSkill("zhenmo",13)

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "wujiyan":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("无极炎", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1.25,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		if sys.rndPer(20):
			var buff = hasBuff("chl")
			if buff == null:
				addBuff(chl.new())
			elif buff.att.atkL < 0.6:
				buff.att.atkL += 0.2

	if id == "chihuoling":
		var buff = hasBuff("chl")
		if buff == null:
			addBuff(chl.new())
		elif buff.att.atkL < 0.6:
			buff.att.atkL += 0.2
		if aiCha !=null:
			aiCha.addBuff(bf.zhuoshao.new(4))
	if id == "zhenmo":
		zhenmo()

func zhenmo():
	var cha = null
	var m = 10000
	var chas = getAllChas(1)
	for i in chas:
		if i.att.hp / i.att.maxHp < m :
			cha = i
			m = i.att.hp / i.att.maxHp
	if cha !=null:
		var d:Eff = newEff("sk_feiDang",sprcPos)
		d._initFlyCha(cha)
		yield(d,"onReach")
		typeHurtCha(cha,att.atk*1.5,Chara.HurtType.PHY,Chara.AtkType.NORMAL,"暗")
		var buff = hasBuff("zhenmoyan")
		if buff == null && atkInfo.isCri:
			addBuff(zhenmoyan.new())



func _onAtkInfo(atkInfo):
	._onAtkInfo(atkInfo)
	if atkInfo.atkCha == self && atkInfo.atkType == Chara.AtkType.NORMAL:
		atkInfo.canCri = true


class chl:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "chl"	
		att.atkL = 0.2

class zhenmoyan:
	extends Buff
	func _init():
		attInit()
		var dispelable = false
		id = "zhenmoyan"	
		att.criR += 0.5